﻿using System;
using System.Collections.Generic;
using Slippor.Douban.Radio.BaseForm.CustomControls;
using Slippor.Douban.Radio.Search;

namespace Slippor.Douban.Radio.BaseForm
{
    public class DoubanRadioSearchService : ISearchService
    {
        private readonly ISearchContainer _container;

        internal DoubanRadioSearchService(ISearchContainer container)
        {
            _container = container;
            Searches = new Dictionary<String, ISearch>();
        }

        #region ISearchService Members

        public Dictionary<String, ISearch> Searches { get; set; }

        public void AddSearch(ISearch search)
        {
            Searches.Add(search.Name, search);
            _container.Add(search);
        }

        public void RemoveSearch(ISearch search)
        {
            Searches.Remove(search.Name);
            _container.Remove(search);
        }

        #endregion
    }
}